#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define NMAX 100000 /* max players */
#define PMAX  60000 /* max player's skill */

int index[NMAX];

/* {{{ Heap sort */
static void
swap_ints(int* a, int* b)
{
	int T;
	T  = *a;
	*a = *b;
	*b =  T;
}



static void
Heap_sort__sift_down(int * array, int start, int end)
{
	int root = start,
	    child,
	    swap;

	while (root * 2 + 1 <= end) {
		child = root * 2 + 1;
		swap = root;

		if (array[swap] < array[child])
			swap = child;

		if (child+1 <= end && array[swap] < array[child+1])
			swap = child+1;

		if (swap != root) {
			swap_ints(&array[root], &array[swap]);
			swap_ints(&index[root], &index[swap]);
			root = swap;
		} else {
			return;
		}
	}
}



static void
Heap_sort__heapify(int* array, int size)
{
	int start = size / 2 - 1;

	while (start >= 0) {
		Heap_sort__sift_down(array, start--, size - 1);
	}
}



static void
Heap_sort(int *array, int size)
{
	int end = size - 1;

	Heap_sort__heapify(array, size);

	while (end > 0) {
		swap_ints(&array[end], &array[0]);
		swap_ints(&index[end], &index[0]);
		Heap_sort__sift_down(array, 0, --end);
	}
}


/* }}} */

static int
make_a_team(int * plyrs, int n, int ** min, int ** max)
{
	int *answer_min = *min,
	    *answer_max = *max;
	int sum = **min + **max,
	    sum_preserve = sum;
	while (*max - plyrs < n - 1) {
		if (*(*max + 1) <= **min + *(*min + 1)) {
			++*max;
			sum += **max;
		} else {
			sum -= **min;
			++*min;
			if (*max - *min <= 1) {
				++*max;
				sum += **max;
			}
		}

		/*
		 * Preserving the best team
		 */
		if (sum_preserve < sum) {
			answer_min = *min;
			answer_max = *max;
			sum_preserve = sum;
		}
	}
	if (**max > **min + *(*min + 1)) {
		//sum -= **min;
		sum_preserve -= **min;
		//++*min;
		++answer_min;
	}

	/* final section */
	*min = answer_min;
	*max = answer_max;
	return sum_preserve;
}



int
main(int argc, char** argv)
{
	int n;
	int igroki[NMAX];
	int *min, *max;
	int *start;
	int i = 0,
	    rating = 0;

	(void)freopen("team.in", "rt", stdin);
	(void)freopen("team.out", "w", stdout);

	(void)scanf("%d\n", &n);
	while (i < n) {
		index[i] = i+1;
		(void)scanf("%d", &igroki[i++]);
	}

	if (n == 1) {
		printf("%d %d\n%d\n", n, igroki[0], index[0]);
		return 0;
	} else if (n == 2) {
		printf("%d %d\n%d\n", n, igroki[0] + igroki[1], 3); /* magic number */
	}

	Heap_sort(igroki, n);

	start = &igroki[0];
	min = &igroki[0];
	max = &igroki[1]; /* works only if we have >1 plyrs */
	rating = make_a_team(igroki, n, &min, &max);

	/*
	 * Output
	 */
	printf("%d %d\n", (int)(max - min + 1), rating);
	for (i = min - start ; i <= max - start ; ++i) {
		printf("%d\n", index[i]);
		fprintf(stderr, "\t - igroki[%d] == %d\n", index[i], igroki[i]);
	}
	return 0;
}
/* vim: foldmethod=marker :
 */
